package com.example.dbhelper.util;

import android.R;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBOpenHelper extends SQLiteOpenHelper {
  private static final String NAME = "data.db";
  //private static final int VERSION = 1;
	private static final String TABLENAME = "t_Food";

	public DBOpenHelper(Context context) {
		String VERSION=context.getString(R.string.version);
		super(context, NAME, null, VERSION);
		// TODO Auto-generated constructor stub
	}

	public DBOpenHelper(Context context, int version) {
		super(context, NAME, null, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("DROP TABLE IF EXISTS"
				+ TABLENAME
				+ "; create table t_Food(id integer primary key,name varchar(20),) ");

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	
			//String sql = "DROP TABLE IF EXISTS " + TABLE_NAME;
			String sql="ALTER TABLE " + TABLENAME + " column_name datatype";
			db.execSQL(sql);				
	}
}
